package eerbaar.internal.level;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import eerbaar.action.IAction;
import eerbaar.context.IContext;
import eerbaar.level.IActions;

public class ActionCollection implements IActions {

    private final List<IAction> actions = new ArrayList<IAction>();

    @Override
    public void addAction(IAction action) {

        this.actions.add(action);
    }

    @Override
    public void execute(IContext model) {

        for (IAction a : this.actions) {
            a.execute(model);
        }
    }

    @Override
    public void execute(IContext model, Map<String, String> map) {

        for (IAction a : this.actions) {
            a.execute(model, map);
        }
    }

    @Override
    public IAction[] getActions() {

        return this.actions.toArray(new IAction[] {});
    }

}
